package com.smart.manager.system.entities.body;

import com.smart.common.entities.core.BaseSearch;
import com.smart.common.entities.option.SelectOption;
import com.smart.manager.system.entities.enums.DictRwState;
import com.smart.manager.system.entities.enums.DictState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.ArrayList;


public class RSystemDict {

    @Data
    @EqualsAndHashCode(callSuper = true)
    @ApiModel("RSystemDict1")
    public static class SearchBody extends BaseSearch {


        @ApiModelProperty("字典代码")
        private String code;


        @ApiModelProperty("字典名称")
        private String name;


        @ApiModelProperty("调用状态")
        private DictState state;
        @ApiModelProperty("读写权限")
        private DictRwState rwState;
    }


    @Data
    @ApiModel("RSystemDict2")
    public static class EditBody implements Serializable {

        /**
         * 字典代码
         */

        @ApiModelProperty("字典代码")
        @NotBlank(message = "字典代码 不能为空")
        @Length(max = 30,message = "字典代码 不能为空")
        private String code;
        /**
         * 字典标题
         */

        @ApiModelProperty("字典名称")
        @NotBlank(message = "字典代码 不能为空")
        private String title;


        /**
         * 调用状态 枚举
         */

        @ApiModelProperty("调用状态 枚举")
        @NotNull(message = "调用状态 不能为空")
        private DictState state;
        /**
         * 字典描述 枚举
         */

        @ApiModelProperty("字典描述")
        @Length(max = 1000, message = "字典描述  不能超过1,000")
        private String description;
        /**
         * 字典明细
         */
        @ApiModelProperty("字典明细")
        @Size(min = 1, message = "字典明细 不能为空")
        @Valid
        private ArrayList<SelectOption> items;


    }


}
